<template>
	<card-content title="我的成果" class="front_index_achievement" to="/front/achievement">
		<el-table :data="tableData" class="hidden-sm-and-down">
			<el-table-column label="状态" width="100">
				<template slot-scope="{ row }">
					<el-tag size="mini" :type="row | tagTypeFilter">{{ row | tabNameFilter }}</el-tag>
				</template>
			</el-table-column>
			<el-table-column label="成果类型" width="120" :formatter="returnAchievementName" />
			<el-table-column label="成果名称" prop="filed1" show-overflow-tooltip min-width="302" />
			<el-table-column label="课题名称" prop="name" show-overflow-tooltip min-width="250" />
			<el-table-column label="成果时间" prop="filed4" min-width="160" show-overflow-tooltip />
			<el-table-column label="操作" width="66" align="center">
				<template slot-scope="{ row }">
					<el-button type="text" @click="handleLookDetail(row)">详情</el-button>
				</template>
			</el-table-column>
		</el-table>
		<div class="sw-card hidden-md-and-up">
			<dl v-for="(item, index) in tableData" :key="index">
				<dt>
					<el-tag size="mini" :type="item | tagTypeFilter">{{ item | tabNameFilter }}</el-tag>
				</dt>
				<dd class="snum">{{ returnAchievementName(item) }}</dd>
				<dd class="name">{{ item.filed1 }}</dd>
				<dd>{{ item.name }}</dd>
				<dd>{{ item.filed4 }}</dd>
				<dd class="button"><el-button type="text" @click="handleLookDetail(item.id)">详细</el-button></dd>
			</dl>
		</div>
	</card-content>
</template>

<script>
import tableMixins from '../common/tableMixins';
import { queryUserPageList } from '@/api/business/tbMarvel';
export default {
	mixins: [tableMixins],
	data() {
		return {
			tableData: []
		};
	},
	mounted() {
		this.getTopicListData();
	},
	methods: {
		returnAchievementName(row) {
			if (row.filed10 === '1') {
				return '期刊论文';
			} else if (row.filed10 === '2') {
				return '授权专利';
			} else if (row.filed10 === '3') {
				return '会议论文';
			} else if (row.filed10 === '4') {
				return '获得奖项';
			}
		},
		async getTopicListData() {
			let params = { page: 1, limit: 6 };
			let result = await queryUserPageList(params).then((res) => res.data);
			if (result.code === '0') {
				this.tableData = result.data || [];
			}
		},

		//查看成果详情
		handleLookDetail(row) {}
	}
};
</script>
<style lang="scss" scoped>
@use './index.scss';
</style>
